<?php	 	 

/**
 * This is the model class for table "satker".
 *
 * The followings are the available columns in table 'satker':
 * @property integer $id
 * @property string $kode
 * @property string $nama_satker
 * @property string $alamat
 * @property string $telp
 * @property string $fax
 * @property string $mobile
 * @property string $kepala
 * @property integer $balai_id
 * @property integer $provinsi_id
 * @property integer $jumlah_pegawai
 * @property string $luas_tanah
 * @property string $status_tanah
 * @property string $luas_gedung_kantor
 * @property string $rumah_dinas
 * @property string $kendaraan_roda_4
 * @property string $kendaraan_roda_3
 * @property string $kendaraan_roda_2
 * @property string $komputer_pengolah_data
 * @property string $komputer_administrasi
 * @property string $komputer_server
 * @property string $notebook
 * @property string $handycam
 * @property string $camera_digital
 * @property string $focus_projector
 * @property string $faximile
 * @property string $jaringan_internet
 */
class Satker extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Satker the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'satker';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('kode, nama_satker, alamat, kepala', 'required'),
			array('provinsi_id, jumlah_pegawai', 'numerical', 'integerOnly'=>true),
			array('kode', 'length', 'max'=>100),
			array('nama_satker, kepala', 'length', 'max'=>256),
			array('telp, fax, mobile, luas_tanah, status_tanah, luas_gedung_kantor, rumah_dinas, kendaraan_roda_4, kendaraan_roda_3, kendaraan_roda_2, komputer_pengolah_data, komputer_administrasi, komputer_server, notebook, handycam, camera_digital, focus_projector, faximile, jaringan_internet', 'length', 'max'=>50),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, kode, nama_satker, alamat, telp, fax, mobile, kepala, provinsi_id, jumlah_pegawai, luas_tanah, status_tanah, luas_gedung_kantor, rumah_dinas, kendaraan_roda_4, kendaraan_roda_3, kendaraan_roda_2, komputer_pengolah_data, komputer_administrasi, komputer_server, notebook, handycam, camera_digital, focus_projector, faximile, jaringan_internet', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}
	
	public function findSatker(){
		$satkers = $this->findAll();
		$i=0;
		foreach ($satkers as $a) :
		$satker[$i]=$a->nama_satker;
		$i++;
		endforeach;
	return $satker;
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'kode' => 'Kode',
			'nama_satker' => 'Nama Satker',
			'alamat' => 'Alamat',
			'telp' => 'Telp',
			'fax' => 'Fax',
			'mobile' => 'Mobile',
			'kepala' => 'Kepala',
			'provinsi_id' => 'Provinsi',
			'jumlah_pegawai' => 'Jumlah Pegawai',
			'luas_tanah' => 'Luas Tanah',
			'status_tanah' => 'Status Tanah',
			'luas_gedung_kantor' => 'Luas Gedung Kantor',
			'rumah_dinas' => 'Rumah Dinas',
			'kendaraan_roda_4' => 'Kendaraan Roda 4',
			'kendaraan_roda_3' => 'Kendaraan Roda 3',
			'kendaraan_roda_2' => 'Kendaraan Roda 2',
			'komputer_pengolah_data' => 'Komputer Pengolah Data',
			'komputer_administrasi' => 'Komputer Administrasi',
			'komputer_server' => 'Komputer Server',
			'notebook' => 'Notebook',
			'handycam' => 'Handycam',
			'camera_digital' => 'Camera Digital',
			'focus_projector' => 'Focus Projector',
			'faximile' => 'Faximile',
			'jaringan_internet' => 'Jaringan Internet',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('kode',$this->kode,true);
		$criteria->compare('nama_satker',$this->nama_satker,true);
		$criteria->compare('alamat',$this->alamat,true);
		$criteria->compare('telp',$this->telp,true);
		$criteria->compare('fax',$this->fax,true);
		$criteria->compare('mobile',$this->mobile,true);
		$criteria->compare('kepala',$this->kepala,true);
		$criteria->compare('provinsi_id',$this->provinsi_id);
		$criteria->compare('jumlah_pegawai',$this->jumlah_pegawai);
		$criteria->compare('luas_tanah',$this->luas_tanah,true);
		$criteria->compare('status_tanah',$this->status_tanah,true);
		$criteria->compare('luas_gedung_kantor',$this->luas_gedung_kantor,true);
		$criteria->compare('rumah_dinas',$this->rumah_dinas,true);
		$criteria->compare('kendaraan_roda_4',$this->kendaraan_roda_4,true);
		$criteria->compare('kendaraan_roda_3',$this->kendaraan_roda_3,true);
		$criteria->compare('kendaraan_roda_2',$this->kendaraan_roda_2,true);
		$criteria->compare('komputer_pengolah_data',$this->komputer_pengolah_data,true);
		$criteria->compare('komputer_administrasi',$this->komputer_administrasi,true);
		$criteria->compare('komputer_server',$this->komputer_server,true);
		$criteria->compare('notebook',$this->notebook,true);
		$criteria->compare('handycam',$this->handycam,true);
		$criteria->compare('camera_digital',$this->camera_digital,true);
		$criteria->compare('focus_projector',$this->focus_projector,true);
		$criteria->compare('faximile',$this->faximile,true);
		$criteria->compare('jaringan_internet',$this->jaringan_internet,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}